package com.xiaodou.mjf.application.core.manager;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Component;

import com.xiaodou.mjf.application.core.service.FinancingStatisticsService;
import com.xiaodou.mjf.application.core.service.InvestService;
import com.xiaodou.mjf.entity.core.FinancingStatistics;
import com.xiaodou.mjf.entity.core.Invest;
import com.xiaodou.mjf.infrastructure.common.app.CommonManager;

@Component
@Transactional
public class ProductManager extends CommonManager{

	@Resource
	InvestService investService;
	@Resource
	FinancingStatisticsService financingStatisticsService;
	
	/**
	 * 多表事务修改 提交购买信息
	 * @param FinancingStatistics
	 * @param invest
	 */
	public void purchase(FinancingStatistics financingStatistics,Invest invest){
		
		try{
			investService.save(invest);
			// 提交更新
			financingStatisticsService.save(financingStatistics);
		}catch(Exception e){
			logger.error(e.toString());
			throw e;
		}

	}
	
}
